package com.sjq.common.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sjq.common.dao.GenericDao;
import com.sjq.common.dao.MainDao;
import com.sjq.common.entity.ApplicationSystem;

@Repository("mainDao")
public class MainDaoImpl extends GenericDao<ApplicationSystem> implements MainDao {
    
    @Override
    public List<Map<String,String>> selectSubMenu(String role, String pid) throws SQLException {
        String sql="select menu.* from T_PZ_SYS_MENU menu inner join T_PZ_SYS_ROLE_MENU role_menu on menu.xxzjbh=role_menu.xxzjbh where menu.fcd_id=? and role_menu.js_id=? and menu.djbgbs != '3' order by menu.cdpx";
        Object[] param = {pid,role};
        return getListBySql(sql,param);
    }
    
    @Override
    public List<Map<String, String>> selectAllSubMenu(String role, String pid) throws SQLException {
        String sql="select menu.* from T_PZ_SYS_MENU menu inner join T_PZ_SYS_ROLE_MENU role_menu on menu.cd_id=role_menu.cd_id where menu.cd_id like ? || '%' and menu.cd_id != ? and role_menu.js_id=? and menu.djbgbs != '3' order by menu.cdpx";
        Object[] param = {pid,pid,role};
        return getListBySql(sql,param);
    }
    
}
